package modelLayer;



import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class test1.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class test1
{
    /**
     * Default constructor for test class test1
     */
    public test1()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }

    

    @Test
    public void brugeroprettelse()
    {
        modelLayer.Ansat ansat1 = new modelLayer.Ansat(1234, "J", Rettigheder.ANSAT);
        assertEquals(1234, ansat1.getSaelgerNr());
        modelLayer.Privat privat1 = new modelLayer.Privat();
        modelLayer.Erhverv erhverv1 = new modelLayer.Erhverv("Computer", "12345678");
        modelLayer.Person person1 = new modelLayer.Person(ansat1, null, "Benny", "Skolegade 1", "9000", "aalborg", "12345678", "j@j.dk");
        modelLayer.Person person2 = new modelLayer.Person(null, privat1, "Abe", "b", "c", "d", "87654321", "d@d.dk");
        modelLayer.Person person3 = new modelLayer.Person(null, erhverv1, "ib", "h", "h", "h", "12345687", "d@g.dk");
        assertEquals("12345678", person1.getTlf());
        assertEquals("87654321", person2.getTlf());
        assertEquals("12345687", person3.getTlf());
        modelLayer.PersonContainer personCo1 = modelLayer.PersonContainer.getInstance();
        personCo1.tilfoejPerson(person1);
        personCo1.tilfoejPerson(person2);
        personCo1.tilfoejPerson(person3);
        assertNotNull(personCo1.findPerson("12345678"));
        personCo1.sletPerson("12345678");
        assertNull(personCo1.findPerson("12345678"));
    }

}




